/*
Copyright SecureKey Technologies Inc. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package multisuite

import (
	"git.cloud.inspur.com/ichain/ichain-sdk-go/pkg/core/cryptosuite/csp/gm"
	"git.cloud.inspur.com/ichain/ichain-sdk-go/pkg/core/cryptosuite/csp/sw"
	core "git.cloud.inspur.com/ichain/ichain-sdk-go/pkg/providers/core"
	"github.com/pkg/errors"
)

// GetSuiteByConfig 根据加密类型获取加密工具
func GetSuiteByConfig(config core.CryptoSuiteConfig) (core.CryptoSuite, error) {
	switch config.SecurityProvider() {
	case "gm":
		return gm.GetSuiteByConfig(config)
	case "sw":
		return sw.GetSuiteByConfig(config)
	}

	return nil, errors.Errorf("Unsupported security provider requested: %s", config.SecurityProvider())
}
